#include<iostream>
using namespace std;

int max(int a,int b)
{
    return a>b?a:b;
}

int abs(int a,int b)
{
    if(a>b) return a-b;
    else return b-a;
}

int main()
{
    int t,i;
    while(cin>>t)
    {
        for(i=0;i<t;i++)
        {
            int n,x1,x2,y1,y2,ans;
            cin>>n>>x1>>y1>>x2>>y2;
            if((x1+y1-x2-y2)%2!=0)
            ans=-1;
            else
                ans=max(abs(x1,x2),abs(y1,y2));
            cout<<"Case "<<i+1<<":"<<endl;
            cout<<ans<<endl;
            if(i<t-1) cout<<endl;
        }
    }
    return 0;
}
